From 608aa777d53e7412da126dd6f9d78455a1915fbd Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Fri, 21 Oct 2005 11:29:51 +0100 Subject: [PATCH] Work around internal error in some versions of x86/64 gcc by manually hoisting gdt address calculation outside loop. Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 7 +++---- xen/arch/x86/setup.c | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 7d61eadfab..c52448d2fd 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -254,6 +254,7 @@ void free_perdomain_pt(struct domain *d) void arch_do_createdomain(struct vcpu *v) { struct domain *d = v->domain; + l1_pgentry_t gdt_l1e; int vcpuid; if ( is_idle_task(d) ) @@ -282,12 +283,10 @@ void arch_do_createdomain(struct vcpu *v) * GDT, and the old VCPU# is invalid in the new domain, we would otherwise * try to load CS from an invalid table. */ + gdt_l1e = l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR); for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ ) - { d->arch.mm_perdomain_pt[ - (vcpuid << PDPT_VCPU_SHIFT) + FIRST_RESERVED_GDT_PAGE] = - l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR); - } + (vcpuid << PDPT_VCPU_SHIFT) + FIRST_RESERVED_GDT_PAGE] = gdt_l1e; v->arch.guest_vtable = __linear_l2_table; v->arch.shadow_vtable = __shadow_linear_l2_table; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 388735fb49..21e4bb810b 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -141,7 +141,7 @@ static void __init do_initcalls(void) static void __init start_of_day(void) { int i; - unsigned long vgdt; + unsigned long vgdt, gdt_pfn; early_cpu_init(); @@ -164,10 +164,10 @@ static void __init start_of_day(void) * noted in arch_do_createdomain(), we must map for every possible VCPU#. */ vgdt = GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE; + gdt_pfn = virt_to_phys(gdt_table) >> PAGE_SHIFT; for ( i = 0; i < MAX_VIRT_CPUS; i++ ) { - map_pages_to_xen( - vgdt, virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR); + map_pages_to_xen(vgdt, gdt_pfn, 1, PAGE_HYPERVISOR); vgdt += 1 << PDPT_VCPU_VA_SHIFT; } -- 2.30.2